/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.wechat.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 微信秒杀Entity
 * @author Jakemanse
 * @version 2013-09-13
 */
@Entity
@Table(name = "wp_seckill")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Seckill extends BaseEntity {
	
	public final static String DEL_FLAG_KILL = "2";
	
	public final static String PUBLISH_FLAG_YES = "1";
	public final static String PUBLISH_FLAG_NO = "0";
	
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private String name; 	// 名称
	private Date startTime;	//秒杀开始时间
	private Date endTime;	//秒杀结束时间
	private Integer amount;	//数量
	private Integer nextAmount;	//下次执行时间
	private Integer frequency;	//重复频，目前只支持天数
	private Integer price;	//价前
	private String logo;	//Logo路径
	private String picPath;	//图片位置
	private String pubFlag;	 //是否发布	0：不发布   1：发布
	private Boolean repeats;	//是否重复  执行秒杀
	private Date createTime;	// 创建日期
	private String delFlag;	// 删除标记（0：正常；1：删除）
	private String remarks; // 描述
	
	private String type;//0  商家秒杀      1微购物秒杀
	private Integer sort;//用于微购物排序        倒序数字大的在前
	
	
	public Seckill() {
		this.createTime = new Date();
		this.frequency = 1;
		this.delFlag = DEL_FLAG_NORMAL;
		this.type="0";
		this.sort=0;
	}

	public Seckill(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_wechat_seckill")
	//@SequenceGenerator(name = "seq_wechat_seckill", sequenceName = "seq_wechat_seckill")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne 
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255)
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	public String getPubFlag() {
		return pubFlag;
	}

	public void setPubFlag(String pubFlag) {
		this.pubFlag = pubFlag;
	}

	public Integer getPrice() {
		return price;
	}

	public void setPrice(Integer price) {
		this.price = price;
	}

	public String getLogo() {
		return logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}

	public String getPicPath() {
		return picPath;
	}

	public void setPicPath(String picPath) {
		this.picPath = picPath;
	}

	public Boolean getRepeats() {
		return repeats;
	}

	public void setRepeats(Boolean repeats) {
		this.repeats = repeats;
	}

	public Integer getNextAmount() {
		return nextAmount;
	}

	public void setNextAmount(Integer nextAmount) {
		this.nextAmount = nextAmount;
	}

	public Integer getFrequency() {
		return frequency == null ? 1 : frequency;
	}

	public void setFrequency(Integer frequency) {
		this.frequency = frequency;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	
	
	
	
	
}


